package com.hsh.maoduo.pojo.other.yd;

import com.hsh.maoduo.anno.Alia;
import com.hsh.maoduo.constant.YDPathConstants;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Objects;

@Data
public class YDImport {
    /**
     * 订单编号
     */
    @Alia("订单号")
    private String orderNo;

    /**
     * 发件人姓名 *
     */
    @Alia("发件人姓名 *")
    private String shopName;
    /**
     * 发件人电话
     */
    @Alia("发件人电话")
    private String shopTel;
    /**
     * 发件人手机 *
     */
    @Alia("发件人手机 *")
    private String shopMobilePhone;
    /**
     * 发件人详细地址 *
     */
    @Alia("发件人详细地址 *")
    private String shopAddress;

    /**
     * 自定义区域1
     */
    @Alia("自定义区域1")
    private String customArea1;
    /**
     * 自定义区域2
     */
    @Alia("自定义区域2")
    private String customArea2;

    /**
     * 收件人姓名 *
     */
    @Alia("收件人姓名 *")
    private String consumerName;
    /**
     * 收件人电话
     */
    @Alia("收件人电话")
    private String consumerTel;
    /**
     * 收件人手机 *
     */
    @Alia("收件人手机 *")
    private String consumerMobilePhone;
    /**
     * 收件人详细地址 *
     */
    @Alia("收件人详细地址 *")
    private String consumerAddress;

    /**
     * 订单类型
     */
    @Alia("订单类型")
    private String orderType;
    /**
     * 到付保价金额
     */
    @Alia("到付保价金额")
    private String quotationAmount;
    /**
     * 代收货款金额
     */
    @Alia("代收货款金额")
    private String paymentAmount;

    /**
     * 重量 :kg
     */
    @Alia("重量")
    private BigDecimal weightKg;
    /**
     * 商品信息 *
     */
    @Alia("商品信息 *")
    private String goodsInfo;
    /**
     * 备注
     */
    @Alia("备注")
    private String note;

    /**
     * 重量 : g
     */
    private Integer weight;

    /**
     * 设置默认值
     */
    public  YDImport init() {
        this.weightKg = BigDecimal.valueOf(this.weight,3);

        this.shopName = YDPathConstants.DEFAULT_SHOP_NAME;
        this.shopAddress = YDPathConstants.DEFAULT_SHOP_ADDRESS;
        this.shopMobilePhone = YDPathConstants.DEFAULT_SHOP_MOBILE_PHONE;
        this.orderType = YDPathConstants.DEFAULT_ORDER_TYPE;
        return this;
//        ydImport.setWeightKg(BigDecimal.valueOf(jdExport.getWeight(), 3));
//
//
//
//        YDImport ydImport = new YDImport();
//        ydImport.shopName = YDPathConstants.DEFAULT_SHOP_NAME;
//        ydImport.shopAddress = YDPathConstants.DEFAULT_SHOP_ADDRESS;
//        ydImport.shopMobilePhone = YDPathConstants.DEFAULT_SHOP_MOBILE_PHONE;
//        ydImport.orderType = YDPathConstants.DEFAULT_ORDER_TYPE;
//        return ydImport;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof YDImport)) return false;
        YDImport ydImport = (YDImport) o;
        return Objects.equals(orderNo, ydImport.orderNo);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orderNo);
    }
}
